<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:core="http://www.contact.core.com/contacts/core/ui"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:profile="http://www.contact.core.profile.com/contacts/core/profile/ui"
      xmlns:atria="http://www.atria.cz/common/jsf"
        >

<ui:component>
    <!--@elvariable id="album" type="rs.contacts.core.core.data.AlbumExt"-->
    <!--@elvariable id="editWhat" type="java.lang.String"-->


    <rich:panel
            bodyClass="rich-laguna-panel-no-header"
            style="text-align:center; max-width:100%; margin:2px">

        <a4j:outputPanel layout="block" style=" width:100%">
            <a4j:outputPanel onclick="viewAlbumPicture#{album.id}();"
                             rendered="#{album.pictureCount != 0}">
                <a4j:mediaOutput element="img" mimeType="#{album.mimeType}"
                                 createContent="#{photosBean.paint}" value="album_#{album.id}"
                                 style="max-width:140px; max-height:220px" cacheable="false"
                        >
                    <f:param value="#{imageSliderBean.timeStamp}" name="time"/>
                </a4j:mediaOutput>

            </a4j:outputPanel>
            <a4j:outputPanel onclick="viewAlbumPicture#{album.id}();"
                             rendered="#{album.pictureCount == 0}">
                <h:graphicImage value="./style/images/question.PNG" style="resize:both; width: 90%;"/>
            </a4j:outputPanel>
            <a4j:jsFunction name="viewAlbumPicture#{album.id}"
                            action="#{photosBean.viewAlbumPicture}"
                            reRender="photosProfileTabPanel,  #{editWhat}">

                <f:setPropertyActionListener value="#{album}"
                                             target="#{photosSessionBean.focusedAlbum}"/>
                <f:setPropertyActionListener value="viewPhotos"
                                             target="#{photosSessionBean.pageViewKey}"/>
            </a4j:jsFunction>
        </a4j:outputPanel>
        <a4j:outputPanel layout="block" style=" width:100%;text-align:left;">
            <h:panelGrid style="background:inherit" styleClass="noborder" columns="1">
                <h:outputText value="#{album.name} " style="color:black;">
                    <h:outputLabel value="#{resources.albumLabel}" style="color:gray;"/>
                </h:outputText>


                <h:outputText value="#{resources.photosLabel}" style="color:gray;">
                    <h:outputText value="#{album.pictureCount}" style="color:black;"/>
                </h:outputText>
                <h:outputLabel rendered="#{not empty album.description}" value="#{album.description}"
                               style="color:black; font-weight:bold"/>

                <h:outputLabel rendered="#{album.haveLasUpdated}" style="color:gray" value="#{resources.updatedLabel} ">
                    <h:outputText style="color:black;" value="#{album.lastUpdate}">
                        <f:convertDateTime pattern="MMMMM dd"/>
                    </h:outputText>
                </h:outputLabel>

                <h:outputLabel rendered="#{album.canDelete}" style="color:gray" value="#{resources.createdLabel} ">
                    <h:outputText style="color:black;" value="#{album.rowTimestamp}">
                        <f:convertDateTime pattern="MMMMM dd"/>
                    </h:outputText>
                </h:outputLabel>

                <a4j:outputPanel rendered="#{not empty editWhat and profile.myProfilePage}">
                    <h:panelGrid columns="5">
                        <a4j:commandLink value="#{resources.editLabel}"
                                         action="#{photosBean.prepareToEditAlbum}"
                                         reRender="photosProfileTabPanel, #{editWhat}"
                                >
                            <f:setPropertyActionListener value="#{album}"
                                                         target="#{photosSessionBean.focusedAlbum}"/>
                            <f:setPropertyActionListener value="editPhotos"
                                                         target="#{photosSessionBean.pageViewKey}"/>
                        </a4j:commandLink>
                        <h:outputLabel style="padding:2px; color:gray" value="|"/>
                        <a4j:commandLink value="#{resources.viewLabel}" onclick="viewAlbumPicture#{album.id}();"/>

                        <h:outputLabel rendered="#{album.canDelete}" style="padding:2px; color:gray"
                                       value="|"/>
                        <a4j:commandLink rendered="#{album.canDelete}"
                                         value="#{resources.deleteLabel}"
                                         action="#{photosBean.prepareToDeleteAlbum}"
                                         reRender="deleteAlbumPanel, #{editWhat}"
                                         oncomplete="Richfaces.showModalPanel('deleteAlbumPanel');"
                                         limitToList="true">
                            <f:setPropertyActionListener value="#{album}"
                                                         target="#{photosSessionBean.focusedAlbum}"/>
                        </a4j:commandLink>

                    </h:panelGrid>


                </a4j:outputPanel>

            </h:panelGrid>
        </a4j:outputPanel>

    </rich:panel>

</ui:component>


</html>
